/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Action;

import BE.Tipocliente;
import BE.Tipoidentificacion;
import BL.TipoClienteBL;
import BL.TipoIdentificacionBL;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;

/**
 *
 * @author dennis
 */
public class mobPrincipalAction extends org.apache.struts.action.Action {
    
    /* forward name="success" path="" */
    
    /**
     * This is the action called from the Struts framework.
     * @param mapping The ActionMapping used to select this instance.
     * @param form The optional ActionForm bean for this request.
     * @param request The HTTP Request we are processing.
     * @param response The HTTP Response we are processing.
     * @throws java.lang.Exception
     * @return
     */
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

            HttpSession session = request.getSession();

            TipoClienteBL objTipoClienteBL = new TipoClienteBL();
            List<Tipocliente> arrTipoCliente = objTipoClienteBL.cargarTipoCliente();
            Tipocliente objTipoCli = new Tipocliente(0,"Todos");
            arrTipoCliente.add(0,objTipoCli);

            TipoIdentificacionBL objTipoIdentificacionBL = new TipoIdentificacionBL();
            List<Tipoidentificacion> arrTipoIdentificacion = objTipoIdentificacionBL.cargarTipoIdentificacion();
            Tipoidentificacion objTipoIdDoc = new Tipoidentificacion(0,"Todos");
            arrTipoIdentificacion.add(0, objTipoIdDoc);

            session.setAttribute("arrTipoCliente", arrTipoCliente);
            session.setAttribute("arrTipoIdentificacion", arrTipoIdentificacion);

        return mapping.findForward("buscarCliente");
    }
}
